﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using QLTV_Public;
using System.Data;

namespace QLTV_Data
{
   public class HeDaoTao_Data
    {
       KetNoiCSDL_Data kn = new KetNoiCSDL_Data();

       public DataTable TaoBang(string sql)
       {
           return kn.taobang(sql);
       }
       public DataTable LayDuLieu()
       {
           return kn.LayDuLieu("Load_HeDaoTao");
       }
       public int Insert(HeDaoTao_Public maHe,HeDaoTao_Public tenHe,HeDaoTao_Public ghiChu)
       {
           int paramater = 3;
           string[] name = new string[paramater];
           object[] value = new object[paramater];
           name[0] = "@MaHe";
           value[0] = maHe.MaHe;
           name[1] = "@TenHeDaoTao";
           value[1] = tenHe.TenHeDaoTao;
           name[2] = "@GhiChu";
           value[2] = ghiChu.GhiChu;

           return kn.update("Insert_HeDaoTao",name,value,paramater);

       }
       public int Update(HeDaoTao_Public maHe, HeDaoTao_Public tenHe, HeDaoTao_Public ghiChu)
       {
           int paramater = 3;
           string[] name = new string[paramater];
           object[] value = new object[paramater];
           name[0] = "@MaHe";
           value[0] = maHe.MaHe;
           name[1] = "@TenHeDaoTao";
           value[1] = tenHe.TenHeDaoTao;
           name[2] = "@GhiChu";
           value[2] = ghiChu.GhiChu;

           return kn.update("Update_HeDaoTao", name, value, paramater);

       }
       public int Delete(HeDaoTao_Public maHe)
       {
           int paramater = 1;
           string[] name = new string[paramater];
           object[] value = new object[paramater];
           name[0] = "@MaHe";
           value[0] = maHe.MaHe;
           
           return kn.update("Delete_HeDaoTao", name, value, paramater);

       }
    }
}
